<?=$this->load->view('include_header',null)?>
<style type="text/css">
form#form textarea {
    height: 50px;
    overflow: auto;
    padding: 5px;
    width: 410px;
}
</style>
	<div id="top-panel">
		<div id="panel">
			<ul>
				<li class="current"><a href="<?=site_url('archive/idcard/'.$id)?>" class="report"><?=(empty($id))?"录入新":"编辑"?>客户基本信息</a></li>
				<?php if(!empty($info->id)):?><li><a id="printInfo" class="folder_table">打印本页信息</a></li><?php endif;?>
			</ul>
		</div>
	</div>
	<div id="wrapper">
		<div id="content">
			<div id="box">
<!-- table begin -->
<form method="post" id="form"  enctype="multipart/form-data" action="<?=site_url('schengen/cl_update/'.$cateid)?>">

	<h3>智利申请表</h3>
    <table width="100%">
    <thead>
        <tr>
          <td colspan="4" align="right"><img src="<?= (@$info->avatar)?@$info->avatar:'images/avatar.gif'?>" width="150" height="150" /></td>
		  <td align="right">
		  上传照片<br />
		  <input type="file" name="userphoto" /><br />
		  (.gif|.jpg|.png文件,最大1M)<br />
		  <?php if (@$info->attachment):?><a href="<?= @$info->attachment?>" target="_blank">点击下载附件</a><?php endif; ?>
		  &nbsp;&nbsp;&nbsp;&nbsp;上传附件<br />
		  <input type="file" name="userfile" /><br />
		  (.pdf|.zip|.rar|.doc,最大2M)		  
		  </td>
        </tr>
    </thead>
    <tfoot>
        <tr>
            <td colspan="5" align="right">			
			<input type="hidden" name="id" value="<?=$id?>" />
			<input id="button1" type="submit" value="提交信息" />
			<input id="button2" type="reset" value="重置" />
			</td>
        </tr>
    </tfoot>

    <tbody>
        <tr class="odd">
            <td colspan="5">1.VISA REQUESTED</td> 
        </tr>
        <tr class="even">
            <td>TYPE OF VISA</td>
            <td>
 <input type="radio" name="visa_type" value="1" <?= (@$info->visa_type==1)?'checked':''?>/> Tourist Visa Single Entry <br />
 <input type="radio" name="visa_type" value="2" <?= (@$info->visa_type==2)?'checked':''?>/> Temporary Resident<br />
 <input type="radio" name="visa_type" value="3" <?= (@$info->visa_type==3)?'checked':''?>/> Work <br />
 <input type="radio" name="visa_type" value="4" <?= (@$info->visa_type==4)?'checked':''?>/> Tourist Visa Multiple Entry <br />
 <input type="radio" name="visa_type" value="5" <?= (@$info->visa_type==5)?'checked':''?>/> Temporary Resident - Dependant<br />
 <input type="radio" name="visa_type" value="6" <?= (@$info->visa_type==6)?'checked':''?>/> Work - Dependant<br />
 <input type="radio" name="visa_type" value="7" <?= (@$info->visa_type==7)?'checked':''?>/> Student Visa</td>
            <td>&nbsp;</td>
            <td colspan="2"><p>LENGTH OF STAY IN CHILE (In days)
              		<br />
              		<input type="text" name="stay_length" value="<?= @$info->stay_length?>" /> <br />
			  FROM (Arrival date)
			  <input type="text" name="arrival_date" value="<?= @$info->arrival_date?>" id="arrival_date" /><br />
			TO  (Departure date) 
			<input type="text" name="departure_date" value="<?= @$info->departure_date?>" id="departure_date" /><br />
           </td>
        </tr>
        <tr class="odd">
            <td colspan="5">2. NAME AND CONTACT INFORMATION</td>
        </tr>
        <tr class="even">
            <td>LAST NAME (As shown in your passport)</td>
            <td><input type="text" name="surname" value="<?= @$info->surname?>" /></td>
            <td>&nbsp;</td>
            <td>FIRST AND MIDDLE NAME (As shown in your passport)</td>
            <td><input type="text" name="firstname" value="<?= @$info->firstname?>" /></td>
        </tr>
        <tr class="odd">
            <td>SEX</td>
            <td><input type="radio" name="sex" value="1" <?= (@$info->sex==1)?'checked':''?> />Male 
              <input type="radio" name="sex" value="2" <?= (@$info->sex==2)?'checked':''?> />Female</td>
			<td>&nbsp;</td>
			<td>DATE OF BIRTH</td>
			<td><select name="birth_d"><?php for($i=1;$i<=31;$i++) echo "<option value='$i'".((@$info->birth_d==$i)?"selected":"").">$i</option>"; ?></select> - 
			<select name="birth_m"><?php for($i=1;$i<=12;$i++) echo "<option value='$i'".((@$info->birth_m==$i)?"selected":"").">$i</option>"; ?></select> - 
			<select name="birth_y"><?php for($i=date("Y");$i>1940;$i--) echo "<option value='$i'".((@$info->birth_y==$i)?"selected":"").">$i</option>"; ?></select></td>
        </tr>
        <tr class="even">
          <td>PERMANENT ADDRESS IN THE USA</td>
		  <td colspan="4">
		  Street address<input type="text" name="usa_address" value="<?= @$info->usa_address?>" style="width:300px" /><br />
		  City<input type="text" name="usa_city" value="<?= @$info->usa_city?>" />&nbsp;&nbsp;State<input type="text" name="usa_state" value="<?= @$info->usa_state?>" />&nbsp;&nbsp;ZIP Code<input type="text" name="usa_zip" value="<?= @$info->usa_zip?>" /></td>
        </tr>
        <tr class="odd">
            <td>PHONE NUMBERS</td>
		  <td colspan="4">Home<input type="text" name="home_tel" value="<?= @$info->home_tel?>" />&nbsp;&nbsp;Work<input type="text" name="work_tel" value="<?= @$info->work_tel?>" />&nbsp;&nbsp;Cell<input type="text" name="cell_tel" value="<?= @$info->cell_tel?>" /><br />
		 Email<input type="text" name="email" value="<?= @$info->email?>" id="email" /></td>
        </tr>
        <tr class="even">
            <td colspan="5">3. PASSPORT AND STATUS</td>
        </tr>
        <tr class="odd">
            <td>NATIONALITY</td>
            <td><input type="text" name="nationality" value="<?= @$info->nationality?>" /></td>
            <td>&nbsp;</td>
            <td>PLACE OF BIRTH</td>
            <td>City<input type="text" name="birth_city" value="<?= @$info->birth_city?>" /><br />
			Country<input type="text" name="birth_country" value="<?= @$info->birth_country?>" /></td>
        </tr>
        <tr class="even">
            <td>PASSPORT NUMBER</td>
            <td><input type="text" name="travel_document_num" value="<?= @$info->travel_document_num?>" /></td>
            <td>&nbsp;</td>
            <td>EXPIRATION DATE</td>
            <td><input type="text" name="travel_document_valid_date" value="<?= @$info->travel_document_valid_date?>"  id="travel_document_valid_date"/> 
            (dd-mm-yyyy)</td>
        </tr>
		        <tr class="odd">
            <td>DATE OF ISSUE</td>
            <td><input name="travel_document_issue_date" type="text" value="<?= @$info->travel_document_issue_date?>" id="travel_document_issue_date" />
(dd-mm-yyyy)</td>
			<td>&nbsp;</td>
			<td>COUNTRY OF ISSUANCE</td>
            <td><input name="travel_document_issue_by" type="text" value="<?= @$info->travel_document_issue_by?>" /></td>
        </tr>
        <tr class="even">
            <td>STATUS IN THE USA</td>
            <td colspan="4">
 <input type="radio" name="usa_status" value="1" <?= (@$info->usa_status==1)?'checked':''?>/> Citizen &nbsp;
 <input type="radio" name="usa_status" value="2" <?= (@$info->usa_status==2)?'checked':''?>/> Green Card Holder &nbsp;
 <input type="radio" name="usa_status" value="3" <?= (@$info->usa_status==3)?'checked':''?>/> Type of Visa &nbsp;
 <input type="radio" name="usa_status" value="4" <?= (@$info->usa_status==4)?'checked':''?>/> Refuge
 
        </tr>		
        <tr class="odd">
            <td colspan="5">4. PERSONAL INFORMATION</td>
        </tr>
        <tr class="even">
            <td>MARITAL STATUS</td>
            <td colspan="4">
			<input type="radio" name="marital_status" value="1" <?= (@$info->marital_status==1)?'checked':''?>/> Single &nbsp;&nbsp;
			<input type="radio" name="marital_status" value="2" <?= (@$info->marital_status==2)?'checked':''?>/> Married &nbsp;&nbsp;
			<input type="radio" name="marital_status" value="3" <?= (@$info->marital_status==3)?'checked':''?>/> Divorced &nbsp;&nbsp;
			<input type="radio" name="marital_status" value="4" <?= (@$info->marital_status==4)?'checked':''?>/> Widow/ed

</td>
        </tr>
        <tr class="odd">
            <td>COLOR OF HAIR</td>
            <td><input type="text" name="color_hair" value="<?= @$info->color_hair?>" /></td>
			<td>&nbsp;</td>
            <td>COLOR OF EYES</td>
			<td><input type="text" name="color_eyes" value="<?= @$info->color_eyes?>" /></td>
        </tr>
        <tr class="even">
            <td>COMPLEXION</td>
			<td><input type="text" name="complexion" value="<?= @$info->complexion?>" /></td>
			<td>&nbsp;</td>
			<td>HEIGHT (In centimeters)</td>
			<td><input type="text" name="height" value="<?= @$info->height?>" /></td>
        </tr>

        <tr class="odd">
            <td>WEIGHT (In kilos)</td>
            <td><input type="text" name="weight" value="<?= @$info->weight?>" /></td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
        </tr>
        <tr class="even">
            <td>LEVEL OF EDUCATION</td>
            <td colspan="4">
 <input type="radio" name="edu_level" value="1" <?= (@$info->edu_level==1)?'checked':''?>/> Elementary &nbsp;&nbsp;
 <input type="radio" name="edu_level" value="2" <?= (@$info->edu_level==2)?'checked':''?>/> Secondary &nbsp;&nbsp;
 <input type="radio" name="edu_level" value="3" <?= (@$info->edu_level==3)?'checked':''?>/> University &nbsp;&nbsp;
 Other <input type="text" name="edu_level_other" value="<?= @$info->edu_level_other?>" /></td>
        </tr>
        <tr class="odd">
            <td>PROFESSION OR DEGREE</td>
			<td><input type="text" name="profession" value="<?= @$info->profession?>" /></td>
			<td>&nbsp;</td>
			<td>OCCUPATION</td>
			<td><input type="text" name="occupation" value="<?= @$info->occupation?>" /></td>
        </tr>
        <tr class="even">
            <td>address and telephone number of current employer, school or university in the United State</td>
            <td colspan="4"><textarea name="usa_employer"><?= @$info->usa_employer?></textarea></td>
        </tr>
        <tr class="odd">
            <td colspan="5">5. FAMILY INFORMATION</td>
        </tr>
        <tr class="even">
            <td>FATHER'S FULL NAME</td>
            <td colspan="4"><input type="text" name="father_name" value="<?= @$info->father_name?>" style="width:300px" /></td>
        </tr>
        <tr class="odd">
            <td>DATE OF BIRTH</td>
			<td>
			<select name="father_birth_d"><option></option><?php for($i=1;$i<=31;$i++) echo "<option value='$i'".((@$info->father_birth_d==$i)?"selected":"").">$i</option>"; ?></select> - 
			<select name="father_birth_m"><option></option><?php for($i=1;$i<=12;$i++) echo "<option value='$i'".((@$info->father_birth_m==$i)?"selected":"").">$i</option>"; ?></select> - 
			<select name="father_birth_y"><option></option><?php for($i=date("Y");$i>1940;$i--) echo "<option value='$i'".((@$info->father_birth_y==$i)?"selected":"").">$i</option>"; ?></select></td>
			<td>&nbsp;</td>
			<td>IS HE LIVING?</td>
			<td><input type="radio" name="is_father_living" value="1" <?= (@$info->is_father_living==1)?'checked':''?>/> Yes 
&nbsp;&nbsp;<input type="radio" name="is_father_living" value="0" <?= (@$info->is_father_living==0)?'checked':''?>/> No</td>
        </tr>
        <tr class="even">
            <td>CITY AND COUNTRY OF BIRTH</td>
			<td><input type="text" name="father_birth_place" value="<?= @$info->father_birth_place?>" /></td>
			<td>&nbsp;</td>
			<td>CITY AND COUNTRY OF RESIDENCE</td>
			<td><input type="text" name="father_residence_place" value="<?= @$info->father_residence_place?>" /></td>
        </tr>
		 <tr class="odd">
            <td>COUNTRY OF CITIZENSHIP</td>
			<td><input type="text" name="father_citizenship" value="<?= @$info->father_citizenship?>" /></td>
			<td>&nbsp;</td>
			<td></td>
			<td></td>
        </tr>
        <tr class="even">
             <td>MOTHER'S FULL NAME</td>
            <td colspan="4"><input type="text" name="mother_name" value="<?= @$info->mother_name?>" style="width:300px" /></td>
        </tr>
        <tr class="odd">
             <td>DATE OF BIRTH</td>
			<td><select name="mother_birth_d"><option></option><?php for($i=1;$i<=31;$i++) echo "<option value='$i'".((@$info->mother_birth_d==$i)?"selected":"").">$i</option>"; ?></select> - 
			<select name="mother_birth_m"><option></option><?php for($i=1;$i<=12;$i++) echo "<option value='$i'".((@$info->mother_birth_m==$i)?"selected":"").">$i</option>"; ?></select> - 
			<select name="mother_birth_y"><option></option><?php for($i=date("Y");$i>1940;$i--) echo "<option value='$i'".((@$info->mother_birth_y==$i)?"selected":"").">$i</option>"; ?></select></td>
			<td>&nbsp;</td>
			<td>IS HE LIVING?</td>
			<td><input type="radio" name="is_mother_living" value="1" <?= (@$info->is_mother_living==1)?'checked':''?>/> Yes 
&nbsp;&nbsp;<input type="radio" name="is_mother_living" value="0" <?= (@$info->is_mother_living==0)?'checked':''?>/> No</td>
        </tr>
        <tr class="even">
            <td>CITY AND COUNTRY OF BIRTH</td>
			<td><input type="text" name="mother_birth_place" value="<?= @$info->mother_birth_place?>" /></td>
			<td>&nbsp;</td>
			<td>CITY AND COUNTRY OF RESIDENCE</td>
			<td><input type="text" name="mother_residence_place" value="<?= @$info->mother_residence_place?>" /></td>
        </tr>
        <tr class="odd">
             <td>COUNTRY OF CITIZENSHIP</td>
			<td><input type="text" name="mother_citizenship" value="<?= @$info->mother_citizenship?>" /></td>
			<td>&nbsp;</td>
			<td></td>
			<td></td>
        </tr>
		
		<tr class="even">
             <td>SPOUSES'S FULL NAME</td>
            <td colspan="4"><input type="text" name="spouse_name" value="<?= @$info->spouse_name?>" style="width:300px" /></td>
        </tr>
        <tr class="odd">
             <td>DATE OF BIRTH</td>
			<td>
			<select name="spouse_birth_d"><option></option><?php for($i=1;$i<=31;$i++) echo "<option value='$i'".((@$info->spouse_birth_d==$i)?"selected":"").">$i</option>"; ?></select> - 
			<select name="spouse_birth_m"><option></option><?php for($i=1;$i<=12;$i++) echo "<option value='$i'".((@$info->spouse_birth_m==$i)?"selected":"").">$i</option>"; ?></select> - 
			<select name="spouse_birth_y"><option></option><?php for($i=date("Y");$i>1940;$i--) echo "<option value='$i'".((@$info->spouse_birth_y==$i)?"selected":"").">$i</option>"; ?></select></td>
			<td>&nbsp;</td>
			<td>COUNTRY OF CITIZENSHIP</td>
			<td><input type="text" name="spouse_citizenship" value="<?= @$info->spouse_citizenship?>" /></td>
        </tr>
        <tr class="even">
            <td>CITY AND COUNTRY OF BIRTH</td>
			<td><input type="text" name="spouse_birth_place" value="<?= @$info->spouse_birth_place?>" /></td>
			<td>&nbsp;</td>
			<td>CITY AND COUNTRY OF RESIDENCE</td>
			<td><input type="text" name="spouse_residence_place" value="<?= @$info->spouse_residence_place?>" /></td>
        </tr>
        <tr class="odd">
             <td>CURRENT ADDRESS AND PHONE NUMBER</td>
			<td colspan="4"><input type="text" name="spouse_address" value="<?= @$info->spouse_address?>" style="width:300px" /></td>
			
        </tr>
		<tr class="even">
            <td>CHILDRENS (Names, Nationality, date of birth (dd/mm/yyyy)</td>
			<td colspan="4"><textarea name="childrens_detail"><?= @$info->childrens_detail?></textarea></td>
        </tr>
        <tr class="odd">
            <td colspan="5">6. ABOUT YOUR STAY IN CHILE</td>
        </tr>
        <tr class="even">
            <td>DETAILS OF HOST (Name, address and telephone number)</td>
            <td colspan="4"><textarea name="host_detail"><?= @$info->host_detail?></textarea></td>
        </tr>
        <tr class="odd">
            <td>LODGING PLACE (Name, address, telephone and reservation number)</td>
            <td colspan="4"><textarea name="lodging_place"><?= @$info->lodging_place?></textarea></td>
        </tr>
        <tr class="even">
            <td>BUSINESS CONTACT (Company name, address, telephone number and contact person in Chile)</td>
            <td colspan="4"><textarea name="business_contact"><?= @$info->business_contact?></textarea></td>
        </tr>
        <tr class="odd">
            <td>REASON FOR THIS TRIP TO CHILE</td>
			<td colspan="4"><textarea name="reasons"><?= @$info->reasons?></textarea></td>
        </tr>
        <tr class="even">
            <td>HAVE YOU PREVIOUSLY APPLIED FOR VISA TO CHILE</td>
			<td colspan="4">
			<input type="radio" name="has_applied" value="1" <?= (@$info->has_applied==1)?'checked':''?>/> Yes 
&nbsp;&nbsp;<input type="radio" name="has_applied" value="0" <?= (@$info->has_applied==0)?'checked':''?>/> No &nbsp;&nbsp;When?<input type="text" name="applied_when" value="<?= @$info->applied_when?>" id="applied_when" /></td>
        </tr>
		 <tr class="odd">
            <td>IF YOU WHERE PREVIOUSLY IN CHILE, PLEASE INDICATE IN WHICH CAPACITY(As tourist, for business, as resident, with working contract, as permanent resident, as s</td>
			<td colspan="4"><input type="text" name="pre_capacity" value="<?= @$info->pre_capacity?>" style="width:300px" /></td>
        </tr>
		 <tr class="even">
            <td>RELATIVES IN CHILE (If any</td>
			<td colspan="4"><input type="text" name="pre_relative" value="<?= @$info->pre_relative?>" style="width:300px" /></td>
        </tr>
		 <tr class="odd">
            <td>LIST OF COUNTRIES YOU HAVE VISITED DURING THE LAST TWELVE MONTHS</td>
			<td colspan="4"><input type="text" name="pre_country" value="<?= @$info->pre_country?>" style="width:300px" /></td>
        </tr>
    </tbody>
	</table>
<!-- table end -->
</form>

			</div>
		</div>
		
		<?=$this->load->view('include_sidebar',array('id'=>$id,'forms'=>$forms))?>
	</div>

<script type="text/javascript">
$().ready(function() {
  $("#form").validate({
    rules: {
		visa_type:"required",
		arrival_date:"required",
		departure_date:"required",
		surname:"required",
		firstname:"required",
		sex:"required",
		nationality:"required",
		travel_document_num:"required",
		travel_document_valid_date:"required",
		travel_document_issue_date:"required",
		marital_status:"required"
    }
  });
  
	$.datepicker.setDefaults(
		{
		dateFormat: 'dd/mm/yy',
		changeMonth: true,
		changeYear: true,
		showOn: "both",
		buttonImage: "images/calendar.gif",
		buttonImageOnly: true
		}
	);

	$("#arrival_date").datepicker();
	$("#departure_date").datepicker();
	$("#travel_document_valid_date").datepicker();
	$("#travel_document_issue_date").datepicker();
	$("#applied_when").datepicker();
	
	$("#email").autoMail();

	$("#printInfo").click(function(o) {
		var prints = [
			{rel_id: <?=$cateid?>, rec_id: <?=$id?>}
		]  ;
		
		var jdata = JSON.stringify(prints);
		//alert(jdata);
		$.post("<?=site_url('proxy/does/'.str_replace('==','',base64_encode('http://'.$_SERVER['SERVER_NAME'].':9090/javaprduct/servlet/test')))?>",{clients:jdata},function(msg){alert(msg)});
	});
	
	$("#printInfo").ajaxError(function(event,request, settings){
		//$(this).append("<li>出错页面:" + settings.url + "</li>");
		alert("无法访问"+ settings.url );
	}); 
 
});
</script>

<?=$this->load->view('include_footer',null)?>